--THIS LUA FILE ISN'T USED!!! THE FUNCTION HAS BEEN MOVED TO DEFAULT
player = ...
numPlayers = #GAMESTATE:GetEnabledPlayers();

return Def.ActorFrame{
        InitCommand=cmd(x,squareLocationX;y,squareLocationY;);
        OnCommand=cmd(diffusealpha,1);
        
        LoadActor("square_selection")..{
            --InitCommand=cmd(y,squareLocation);
            --CurrentSongChangedMessageCommand=cmd(playcommand,"On");
            CurrentStepsP1ChangedMessageCommand=function(self)
                if GAMESTATE:IsPlayerEnabled(player) then
                    self:playcommand("Animate");
                end;
            end;
        CurrentStepsP2ChangedMessageCommand=function(self)
                if GAMESTATE:IsPlayerEnabled(player) then
                    self:playcommand("Animate");
                end;
            end;
        
            AnimateCommand=function(self)
                if GAMESTATE:GetCurrentSteps(player) then
                    self:finishtweening()
                    self:cropleft(0)
                    self:sleep(0.03)
                    self:decelerate(.2)
                    self:cropleft(1)
                    self:decelerate(0)
                    self:diffusealpha(1)
                    self:cropleft(0)
                    --self:x(tLocation[diffname] + 60)
                    --self:addx(i*23 + 5)

                    local diffname = ToEnumShortString(GAMESTATE:GetCurrentSteps(player):GetDifficulty());
                    if diffname == "Beginner" then
                        self:diffuse(Color("HoloBlue"))
                        self:x(0);
                        self:y(squareLocation);
                    elseif diffname == "Easy" then
                        self:diffuse(Color("HoloOrange"))
                        self:x(squareLocation*.5);
                        self:y(squareLocation*1.5);
                    elseif diffname == "Medium" then
                        self:diffuse(color("1,0,1,1"))
                        self:x(0);
                        self:y(squareLocation*2);
                    elseif diffname == "Hard" then
                        self:diffuse(Color("Green"))
                        self:x(squareLocation*.5);
                        self:y(squareLocation*2.5);
                    elseif diffname == "Challenge" then
                        self:diffuse(color("#9900ff"))
                        self:x(0);
                        self:y(squareLocation*3);
                    end;

                    self:diffusealpha(1)
                
                    if numPlayers ~= 1 and player == "PlayerNumber_P2" then
                        self:cropleft(1)
                    else
                        self:cropright(1)
                    end;
                
                    self:sleep(0.03)
                    self:decelerate(0.2)
                
                    if numPlayers ~= 1 and player == "PlayerNumber_P1" then
                        self:cropright(0.5)
                    elseif numPlayers ~= 1 and player == "PlayerNumber_P2" then
                        self:cropleft(.5);
                    else
                        self:cropright(0);
                    end;
                end;
            end;
        };
    };